//
//  ReportTableViewCell.m
//  CoolTennisBall
//
//  Created by 谢伟康 on 15/12/18.
//  Copyright © 2015年 CoolLang. All rights reserved.
//

#import "ReportTableViewCell.h"
#import "SportDetailItemModel.h"
#import <UICountingLabel/UICountingLabel.h>

@interface ReportTableViewCell ()
@property (weak, nonatomic) IBOutlet UILabel *reportNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *reportDesLabel;
@property (weak, nonatomic) IBOutlet UICountingLabel *reportValueLabel;
@property (weak, nonatomic) IBOutlet UILabel *reportUnitLabel;
@end

@implementation ReportTableViewCell

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    self.reportValueLabel.format = @"%d";
    self.reportValueLabel.method = UILabelCountingMethodEaseInOut;
}

- (void)configureModel:(SportDetailItemModel *)model
           atIndexPath:(NSIndexPath *)indexPath
{
    self.reportNameLabel.text = model.title;
    self.reportDesLabel.text = model.descrip;
    [self.reportValueLabel countFrom:0 to:[model.value floatValue] withDuration:1.0f];
    self.reportUnitLabel.text = model.unit;
    
    switch (indexPath.row) {
        case 0: self.reportValueLabel.textColor = [UIColor colorWithHex:0x25c9ad]; break;
        case 1: self.reportValueLabel.textColor = [UIColor colorWithHex:0x7abeea]; break;
        case 2: self.reportValueLabel.textColor = [UIColor colorWithHex:0xff8560]; break;
        case 3: self.reportValueLabel.textColor = [UIColor colorWithHex:0xf8c353]; break;
        default: break;
    }
}

@end
